package com.example.observer;

public class Main {
    public static void main(String[] args) {
        //就是一个实体类  一旦set就会调用Watcher  循环遍历update方法  执行相关逻辑
        Watched watched = new Watched();
        //监听实体类中
        Watcher watcher = new Watcher(watched);
        watched.setData("start");
        watched.setData("run");
        watched.setData("stop");
    }
}
